package com.logos.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Spring AI配置类
 * @author logos
 */
@Configuration
public class SpringAiConfig {

    /**
     * 形参决定调用的大模型
     */
    @Bean
    public ChatClient chatClient(OllamaChatModel ollamaChatModel) {
        return ChatClient
        .builder(ollamaChatModel)
        .defaultSystem("你是一个热心可爱的智能助手，你的名字叫做艾伦，请以艾伦的身份和语气进行回答")
                // 配置日志Advisor
                .defaultAdvisors(new SimpleLoggerAdvisor())
        .build();
    }
}